[SECTION .data]
disp_pos dd 0

[SECTION .text]
global disp_str

; 显示一个字符串，相当于void disp_str(char *str)
disp_str:
	push ebp
	mov ebp, esp
	
	; str字符串首地址
	mov esi, dword [ebp + 8]
	mov edi, dword [disp_pos]
	
	mov ah, 0Fh
.1:
	lodsb ; 相当于mov al, byte [ds:esi]  inc esi
	cmp al, 0
	jz .2
	
	cmp al, 0Ah
	jnz .3
	
	push eax
	mov eax, edi
	mov bl, 160
	div bl
	and eax, 0FFh
	inc eax
	mov bl, 160
	mul bl
	mov edi, eax
	pop eax
	jmp .1
.3:
	mov [gs:edi], ax
	add edi, 2
	jmp .1
	
.2:
	mov dword [disp_pos], edi
	
	pop ebp
	ret